package org.tjut.test;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.tjut.orm.Student;

public class SpringTestDriver {

	@Test
	public void testSpring1(){
		//获取Spring 容器的上下文对象
		ApplicationContext context= new ClassPathXmlApplicationContext("appConfigure.xml");
		
		Student stu = (Student) context.getBean("StudentBean");
		System.out.println("从Spring容器获取的bean对象的内容："+stu.toString());
		
		Student stu1=(Student) context.getBean("StudentBean");
		System.out.println("从Spring容器获取的bean对象的内容："+stu1.toString());
		//xml文件中，<bean>中若写scope="prototype"，则结果为false，反之为true
		//必须加scope="prototype"
		System.out.println("先后两次取Bean对象判断是否相等==，结果："+(stu==stu1));
	}
}
